package com.ruoyi.project;

import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.project.member.domain.MemberCar;
import com.ruoyi.project.member.domain.MemberCoupon;
import com.ruoyi.project.member.utils.CarExamBo;
import me.chanjar.weixin.common.error.WxErrorException;

import java.io.File;
import java.util.Date;

public class Demo {

    public static void main(String[] args) throws WxErrorException {
//        MemberCoupon coupon = new MemberCoupon();
//        coupon.setExpireTime(DateUtil.parse("2020-10-12 22:50:18"));
//        int compare = DateUtil.compare(new Date(), coupon.getExpireTime());
//        System.out.println(compare);

//        testQr();

        testDateBetwen();
    }


    public static void  testQr() throws WxErrorException {

        WxMaService wxMaMemberServices = SpringUtils.getBean("wxMaMemberService");
        WxMaQrcodeService qrcodeService = wxMaMemberServices.getQrcodeService();
        File wxaCodeUnlimit = qrcodeService.createWxaCodeUnlimit("111", "pages/index/index");
    }


    public static void testDateBetwen(){
        Date now = new Date();
        CarExamBo carExamBo = new CarExamBo();
        DateTime parse = DateUtil.parse("2020-12-01", DatePattern.NORM_DATE_PATTERN);
        carExamBo.setExStartDate(parse);
//        long between = DateUtil.betweenMonth(now, carExamBo.getExStartDate(), false);
//        System.out.println(between);
        int month = DateUtil.month(carExamBo.getExStartDate()) + 1;
        int month1 = DateUtil.month(now) + 1;
        System.out.println(month);
        System.out.println(month1);
        System.out.println(month - month1);
    }
}
